#include <vector>
#include <string>
#include <sstream>
#include <iostream>

using namespace std;

string run_length_encoding(const string &s) {
  ostringstream oss;  
  int curr_len = 1;

  for (int i = 1; i < s.size(); ++i) {
    if (s[i - 1] != s[i] || curr_len == 9) {
      oss << curr_len << s[i - 1];
      curr_len = 0;
    }
    
    curr_len += 1;
  }

  oss << curr_len << *(s.end() - 1);

  return oss.str();
}

int main(int argc, char const *argv[])
{
  /* code */
  cout << run_length_encoding("AABBCCCCCCCCCC") << endl;
  return 0;
}
